CSharpTest.Net
LurchTable<TKey,TValue> Constructor(Int32)
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Collections Namespace > LurchTable<TKey,TValue> Class > LurchTable<TKey,TValue> Constructor : LurchTable<TKey,TValue> Constructor(Int32)

capacity

Glossary Item Box

Creates a LurchTable that can store up to (capacity) items efficiently.

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal capacity As Integer _
)
C# 
public LurchTable<TKey,TValue>( 
   int capacity
)

Parameters

capacity

Example

Library/Library.Test/TestLurchTable.cs

C#Copy Code
var cmp = new IntComparer();
const int limit = 5;

Assert.AreEqual(LurchTableOrder.None, new LurchTable<int, int>(1).Ordering);
Assert.AreEqual(LurchTableOrder.Insertion, new LurchTable<int, int>(1, LurchTableOrder.Insertion).Ordering);
Assert.IsTrue(ReferenceEquals(cmp, new LurchTable<int, int>(1, LurchTableOrder.Insertion, cmp).Comparer));
Assert.AreEqual(LurchTableOrder.Modified, new LurchTable<int, int>(LurchTableOrder.Modified, limit).Ordering);
Assert.AreEqual(limit, new LurchTable<int, int>(LurchTableOrder.Modified, limit).Limit);
Assert.AreEqual(LurchTableOrder.Access, new LurchTable<int, int>(LurchTableOrder.Access, limit, cmp).Ordering);
Assert.AreEqual(limit, new LurchTable<int, int>(LurchTableOrder.Access, limit, cmp).Limit);
Assert.IsTrue(ReferenceEquals(cmp, new LurchTable<int, int>(LurchTableOrder.Access, limit, cmp).Comparer));
Assert.AreEqual(LurchTableOrder.Access, new LurchTable<int, int>(LurchTableOrder.Access, limit, 1, 1, 1, cmp).Ordering);
Assert.AreEqual(limit, new LurchTable<int, int>(LurchTableOrder.Access, limit, 1, 1, 1, cmp).Limit);
Assert.IsTrue(ReferenceEquals(cmp, new LurchTable<int, int>(LurchTableOrder.Access, limit, 1, 1, 1, cmp).Comparer));
VB.NETCopy Code
Dim cmp As var = New IntComparer()
Const  limit As Integer = 5

Assert.AreEqual(LurchTableOrder.None, New LurchTable(Of Integer, Integer)(1).Ordering)
Assert.AreEqual(LurchTableOrder.Insertion, New LurchTable(Of Integer, Integer)(1, LurchTableOrder.Insertion).Ordering)
Assert.IsTrue(ReferenceEquals(cmp, New LurchTable(Of Integer, Integer)(1, LurchTableOrder.Insertion, cmp).Comparer))
Assert.AreEqual(LurchTableOrder.Modified, New LurchTable(Of Integer, Integer)(LurchTableOrder.Modified, limit).Ordering)
Assert.AreEqual(limit, New LurchTable(Of Integer, Integer)(LurchTableOrder.Modified, limit).Limit)
Assert.AreEqual(LurchTableOrder.Access, New LurchTable(Of Integer, Integer)(LurchTableOrder.Access, limit, cmp).Ordering)
Assert.AreEqual(limit, New LurchTable(Of Integer, Integer)(LurchTableOrder.Access, limit, cmp).Limit)
Assert.IsTrue(ReferenceEquals(cmp, New LurchTable(Of Integer, Integer)(LurchTableOrder.Access, limit, cmp).Comparer))
Assert.AreEqual(LurchTableOrder.Access, New LurchTable(Of Integer, Integer)(LurchTableOrder.Access, limit, 1, 1, 1, cmp).Ordering)
Assert.AreEqual(limit, New LurchTable(Of Integer, Integer)(LurchTableOrder.Access, limit, 1, 1, 1, cmp).Limit)
Assert.IsTrue(ReferenceEquals(cmp, New LurchTable(Of Integer, Integer)(LurchTableOrder.Access, limit, 1, 1, 1, cmp).Comparer))

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys